﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="WebApplication1.WebForm1" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
        <div>
             姓名：<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
            <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ErrorMessage="账号不能为空！" Display="Dynamic" ControlToValidate="TextBox1">*</asp:RequiredFieldValidator>
            <asp:CustomValidator ID="CustomValidator1" runat="server" ErrorMessage="名字不能为admin" Display="Dynamic" ControlToValidate="TextBox1" OnServerValidate="CustomValidator1_ServerValidate"></asp:CustomValidator>
            <br />

            密码：<asp:TextBox ID="TextBox2" runat="server" TextMode="Password"></asp:TextBox>
            <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ErrorMessage="密码不能为空！" ControlToValidate="TextBox2" Display="Dynamic">*</asp:RequiredFieldValidator>
            <br />

            再次输入密码：<asp:TextBox ID="TextBox3" runat="server" TextMode="Password"></asp:TextBox>
            <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" ErrorMessage="二次密码不能为空！" ControlToValidate="TextBox3" Display="Dynamic">*</asp:RequiredFieldValidator>
            <asp:CompareValidator ID="CompareValidator1" runat="server" ErrorMessage="密码不一致，请重新输入" ControlToCompare="TextBox2" ControlToValidate="TextBox3" Display="Dynamic">*</asp:CompareValidator>
            <br />

            年龄：<asp:TextBox ID="TextBox4" runat="server"></asp:TextBox>
            <asp:RangeValidator ID="RangeValidator1" runat="server" ErrorMessage="年龄在0~100岁之间哦" ControlToValidate="TextBox4" Display="Dynamic" Type="Integer" MaximumValue="100" MinimumValue="0">*</asp:RangeValidator>
            <br />

            出生日期：<asp:TextBox ID="TextBox5" runat="server"></asp:TextBox>
            <asp:RangeValidator ID="RangeValidator2" runat="server" ErrorMessage="出生日期不在范围内啦，要从1900年开始" Display="Dynamic" Type="Date" MinimumValue="1900-01-01" MaximumValue="2021-07-01" ControlToValidate="TextBox5">*</asp:RangeValidator>
            <asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" ErrorMessage="格式不对哟，正确格式为1900-01-01呢" Display="Dynamic" ControlToValidate="TextBox5" ValidationExpression="^\d{4}-\d{2}-\d{2}$">*</asp:RegularExpressionValidator>
            <br />

            毕业时间：<asp:TextBox ID="TextBox6" runat="server"></asp:TextBox>
            <asp:CompareValidator ID="CompareValidator2" runat="server" ErrorMessage="毕业时间要在你出生之前呢" ControlToCompare="TextBox5" ControlToValidate="TextBox6" Display="Dynamic" Operator="GreaterThan" Type="Date">*</asp:CompareValidator>
            <br />

            邮箱：<asp:TextBox ID="TextBox7" runat="server"></asp:TextBox>
            <asp:RegularExpressionValidator ID="RegularExpressionValidator2" runat="server" ErrorMessage="邮箱格式不正确耶" ControlToValidate="TextBox7" Display="Dynamic" ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*">*</asp:RegularExpressionValidator>
            <br />

            <asp:Button ID="Button1" runat="server" Text="提交" OnClick="Button1_Click" /><asp:Literal ID="Literal2" runat="server"></asp:Literal>
            <br />
            错误汇总：<asp:ValidationSummary ID="ValidationSummary1" runat="server" DisplayMode="SingleParagraph" ShowMessageBox="True" />
            <asp:Literal ID="Literal1" runat="server"></asp:Literal>
        </div>
    </form>
</body>
</html>
